from django.contrib import admin

from auto_task.models import TestTask, TestResult


# Register your models here.

# 测试任务
@admin.register(TestTask)
class TestTaskAdmin(admin.ModelAdmin):
    list_display = ['project','project_version', 'name', 'desc', 'status', 'create_time']
    list_display_links = ['name']
    list_filter = ['project','status']
    search_fields = ['name', 'desc']
    list_editable = ['status']
    date_hierarchy = 'create_time'
    ordering = ['id']
    fields = ['project','project_version', 'name', 'desc']

# 测试结果

@admin.register(TestResult)
class TestResultAdmin(admin.ModelAdmin):
    list_display = ['task', 'name', 'desc', 'status', 'create_time']
    list_display_links = ['task']
    list_filter = ['status']
    search_fields = ['task__name', 'name', 'desc']
    list_editable = ['status']
    date_hierarchy = 'create_time'
    ordering = ['id']
    fields = ['task', 'name', 'desc', 'status']